package cn.com.manager.controller.purchase.listener;

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;

import cn.com.manager.pojo.PurchaseOrder;
import cn.com.manager.service.PurchaseService;
import cn.com.manager.utility.BeanHolder;

/**
 * 流程结束时，更新采购单状态
 */
public class PurchaseOrderCompleteListener implements ExecutionListener{
	@Override
	public void notify(DelegateExecution execution) throws Exception {
		//execution是流程实例 的代理对象
		PurchaseService purchaseService = (PurchaseService)BeanHolder.applicationContext.getBean("purchaseServiceImpl");
		PurchaseOrder order = new PurchaseOrder();
		order.setId(execution.getProcessBusinessKey());
		order.setStatus("2");
		purchaseService.updatePurchaseOrderStatus(order);
	}

}
